package com.huayi.website.entity;

/**
 * 描述：
 * 网站栏目
 *
 * @author qlp
 * @date 2019-09-18 19:44
 */
public enum EnumLanguage {
    CHINESE("中文", 1,"zh"),
    ENGLISH("ENGLISH", 2,"en");

    private String name;
    private String language;
    private int index;

    // 构造方法
    private EnumLanguage(String name, int index,String language) {
        this.name = name;
        this.index = index;
        this.language = language;
    }

    // 普通方法
    public static String getName(int index) {
        for (EnumLanguage c : EnumLanguage.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static EnumLanguage getEnum(String language){
        for (EnumLanguage c : EnumLanguage.values()) {
            if (c.getLanguage().equalsIgnoreCase(language)) {
                return c;
            }
        }
        return null;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
